Skip to content

Conversation

@mielvds
Copy link
Collaborator

@mielvds mielvds commented Nov 4, 2025

This PR moves functionality from context_resolver.py to iri_resolver.py so it can be maintained and tested separately.
This includes:

  • isolating the resolving of relative to absolute IRIs in a separate resolve() function and adding unittests
  • moving the existing function remove_dot_segments() and adding unittests

This work is inspired by https://github.com/rubensworks/relative-to-absolute-iri.js (which is used in https://github.com/rubensworks/jsonld-streaming-parser.js) and can be considered a JS to Python port. The unittests are also ported from that repo as they battle-test both functions.

This PR is work in progress and currently uses pytest for convenience (this might change later).

@mielvds mielvds added this to the v2.0.5 milestone Nov 4, 2025
@mielvds mielvds force-pushed the split-and-test-iri-resolving branch 2 times, most recently from 24b1ce6 to 65201a2 Compare November 25, 2025 20:44
@mielvds mielvds mentioned this pull request Nov 26, 2025
@mielvds mielvds force-pushed the split-and-test-iri-resolving branch from 65201a2 to fbe2bcf Compare December 4, 2025 13:42
@mielvds mielvds changed the base branch from master to migrate-to-pytest December 4, 2025 13:45
@mielvds mielvds marked this pull request as ready for review December 4, 2025 13:46
Copy link
Member

@davidlehn davidlehn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • In jsonld.js I think there was a similar move to a url.js file. Someday I want to see if the js URL api can replace a lot of this. Not sure if there's a similar library for python or what considerations there are using such a thing.
  • I think at some point it may have been decided not to put too many URL related tests in the main test suite. There are some. Perhaps at some point later we could extract these tests out into something shareable between implementations.

@davidlehn
Copy link
Member

  • In jsonld.js I think there was a similar move to a url.js file. Someday I want to see if the js URL api can replace a lot of this. Not sure if there's a similar library for python or what considerations there are using such a thing.

I now see the next related PR has a move to a more standard library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants